home *** CD-ROM | disk | FTP | other *** search
/ Cracking 2 / Cracking II..iso / Texty / crackme / SiFLyiNG_4.txt < prev    next >
Encoding:
Text File  |  1999-07-25  |  8.5 KB  |  218 lines

  1.  
  2.         SiFLyiNG
  3.                 Tutorial #4
  4.  
  5.  
  6. ___________________________________________________________________________
  7.  
  8. Target          : Execution Crackme 0.1
  9.                   d/l it on EB site : http://crackme.cjb.net
  10. Protection Type : Serial/Name, VB5
  11. Level           : 1 for serial sniffing, 2 for keygen (i think )
  12. Tools needed    : SoftIce 3.xx 
  13.     WinDasm     
  14.                   VB for keygen
  15.                   Basis of VB cracking
  16. ___________________________________________________________________________
  17.  
  18. Before beginning...
  19.  
  20.         First of all i advise you EB tut 29 available on
  21. http://crackmes.cjb.net on how to find a serial for this crackme. In this
  22. tut i'll explain how to make a keygen wich calculates a valid serial in
  23. function of the name.
  24.         So, you have read EB tutorial ??? now you are ready :)
  25.  
  26. ___________________________________________________________________________
  27.  
  28. The essay...
  29.  
  30.         This is a VB crackme. To get a valid serial, you make a breakpoint
  31. the comparison funtion __vbaStrComp ( string compare ). But in our case we
  32. want to make a keygen. Just remember what EB says in his tut : 'this program
  33. requires a code which is based on your name that is converted in upper case.'
  34. Upper case ? so our enry point will be the call to the function which converts
  35. our name in Upper Case : but what's the name of this function ? Hummm, let's
  36. use WinDasm in order to find the name of this function. Dasm the crackme
  37. and look at the imports in Functions/Imports. What do we find :
  38. rtcUpperCaseVar seems interesting :) So bpx on it, exit from Sice, enter
  39. any name, any code... and press 'Register'
  40.         There we're back to SoftIce. Return from the call with F11. You see
  41. that code :
  42.  
  43. * Reference To: MSVBVM50.rtcUpperCaseVar, Ord:0210h
  44.                                   |
  45. :0040D96F Call dword ptr [0040F13C]
  46. :0040D975 lea eax, dword ptr [ebp-54]
  47. :0040D978 push eax
  48.  
  49.         Now, we're in the code but it's not very interesting. If you trace 
  50. with F10, you'll soon reach this piece of code, wich is the beginning of
  51. the loop wich calculates the serial :
  52.  
  53. * Referenced by a (U)nconditional or (C)onditional Jump at Address:
  54. |:0040DAFE(U)
  55. |
  56. :0040D9BC cmp si, word ptr [ebp+FFFFFF48] ;compare esi with len of name
  57. :0040D9C3 jg 0040DB03              ; jump out of the loop if esi > len of name
  58. :0040D9C9 lea ecx, dword ptr [ebp-28]     ; wich means that the end of the name
  59. :0040D9CC lea edx, dword ptr [ebp-44]     ; has been reached.
  60. :0040D9CF movsx eax, si
  61. :0040D9D2 mov dword ptr [ebp-7C], ecx
  62. :0040D9D5 push edx
  63. :0040D9D6 lea ecx, dword ptr [ebp+FFFFFF7C]
  64. :0040D9DC push eax
  65. :0040D9DD lea edx, dword ptr [ebp-54]
  66. :0040D9E0 push ecx
  67. :0040D9E1 push edx
  68. :0040D9E2 mov [ebp-3C], 00000001
  69. :0040D9E9 mov [ebp-44], 00000002
  70. :0040D9F0 mov dword ptr [ebp+FFFFFF7C], 00004008
  71.  
  72. * Reference To: MSVBVM50.rtcMidCharVar, Ord:0278h
  73.                                   |
  74. :0040D9FA Call dword ptr [0040F130]
  75. :0040DA00 lea eax, dword ptr [ebp-54]
  76. :0040DA03 push eax
  77.  
  78.         The mid Function returns a variant (string) contaigning a specified
  79. number of characters from a string. Here it returns a char from the entered
  80. name, used to calculate the serial. At each loop, it returns the next char
  81. until it has reached the end of the name (test at adress 0040D9C3) .
  82.  
  83. * Reference To: MSVBVM50.__vbaStrVarMove, Ord:0000h
  84.                                   |
  85. :0040DA04 Call dword ptr [0040F0F4]
  86. :0040DA0A mov edx, eax                    ; type 'd eax' and you'll see the 
  87. :0040DA0C lea ecx, dword ptr [ebp-18]     ; returned char of the name in
  88. :0040DA0F call ebx                        ; upper case.
  89. :0040DA11 lea ecx, dword ptr [ebp-54]
  90. :0040DA14 lea edx, dword ptr [ebp-44]
  91. :0040DA17 push ecx
  92. :0040DA18 push edx
  93. :0040DA19 push 00000002
  94.  
  95. * Reference To: MSVBVM50.__vbaFreeVarList, Ord:0000h
  96.                                   |
  97. :0040DA1B Call dword ptr [0040F0FC]
  98. :0040DA21 mov eax, dword ptr [ebp-18]
  99. :0040DA24 add esp, 0000000C
  100. :0040DA27 push eax
  101.  
  102. * Reference To: MSVBVM50.rtcAnsiValueBstr, Ord:0204h
  103.                                   |
  104. :0040DA28 Call dword ptr [0040F108]
  105.  
  106. This funtion returns in eax the value of the char in upper case of the name
  107. Example : 'S' = 53h => eax = 53 or ax = 53
  108.  
  109. :0040DA2E sub ax, 0040   ; ax = ax-40h
  110. :0040DA32 jo 0040DCD9    ; jump to the error message if overflow
  111. :0040DA38 imul ax, 0082  ; ax = ax * 82h
  112. :0040DA3D jo 0040DCD9
  113. :0040DA43 add ax, di     ; ax = ax + di  (di=0 at the beginning of the loop)                                                   
  114. :0040DA46 jo 0040DCD9
  115. :0040DA4C add ax, 0050   ; ax = ax + 50h
  116. :0040DA50 jo 0040DCD9
  117. :0040DA56 add ax, 0050   ; ax = ax + 50h
  118. :0040DA5A jo 0040DCD9
  119. :0040DA60 add ax, 0050   ; ax = ax + 50h
  120. :0040DA64 jo 0040DCD9
  121. :0040DA6A add ax, 0050   ; ax = ax + 50h
  122. :0040DA6E jo 0040DCD9
  123. :0040DA74 add ax, 0050   ; ax = ax + 50h
  124. :0040DA78 jo 0040DCD9
  125. :0040DA7E add ax, 0050   ; ax = ax + 50h
  126. :0040DA82 jo 0040DCD9
  127. :0040DA88 add ax, 0050   ; ax = ax + 50h
  128. :0040DA8C jo 0040DCD9
  129. :0040DA92 add ax, 0050   ; ax = ax + 50h
  130. :0040DA96 jo 0040DCD9
  131. :0040DA9C add ax, 0050   ; ax = ax + 50h
  132. :0040DAA0 jo 0040DCD9
  133. :0040DAA6 add ax, 0050   ; ax = ax + 50h
  134. :0040DAAA jo 0040DCD9
  135. :0040DAB0 add ax, 0050   ; ax = ax + 50h
  136. :0040DAB4 jo 0040DCD9
  137. :0040DABA add ax, 0050   ; ax = ax + 50h
  138. :0040DABE jo 0040DCD9
  139. :0040DAC4 add ax, 0050   ; ax = ax + 50h
  140. :0040DAC8 jo 0040DCD9
  141. :0040DACE add ax, 0050   ; ax = ax + 50h
  142. :0040DAD2 jo 0040DCD9
  143. :0040DAD8 add ax, 0050   ; ax = ax + 50h
  144. :0040DADC jo 0040DCD9
  145. :0040DAE2 add ax, 0050   ; ax = ax + 50h
  146. :0040DAE6 jo 0040DCD9
  147. :0040DAEC mov edi, eax       ; store eax in edi to use it at the next loop
  148. :0040DAEE mov eax, 00000001  ; eax = 1    -
  149. :0040DAF3 add ax, si         ; ax = ax + si    | these lines increase esi
  150. :0040DAF6 jo 0040DCD9            |
  151. :0040DAFC mov esi, eax       ; esi = eax     -
  152. :0040DAFE jmp 0040D9BC       ; jump to next char of the name
  153.  
  154.          Thus, this loop depends on the len of the entered name. It uses all
  155. char of the name in upper case. And the result is each time stored in edi at
  156. 40DAEC. So that, when the loop has ended and it jumps from 40D9C3 to 40DB03,
  157. the serial is in edi... and will finally be converted in a string then compared
  158. with the entered serial. Ok, now we know how to make a keygen for this
  159. crackme. So let's go...
  160.  
  161. ____________________________________________________________________________
  162.  
  163. The Keygen... in VB
  164.  
  165.         First of all, the name is converted in Upper Case (very important).
  166.  
  167. user_name = UCase$(user_name)
  168. edi = 0 
  169.  
  170. ... then the loop :
  171.  
  172.         For i= 1 to len(user_name)
  173.                 
  174.     Char_name = Asc(Mid$(user_name, i, 1)) 'this will return
  175.                                             'the char(i) from the name
  176.                 eax = Char_name
  177.                 eax = eax - &h40    ' ax = ax - 40h
  178.                 eax = eax * &h82     ' ax = ax * 82h                                           
  179.                 eax = eax + edi
  180.                 eax = eax + (&h50 * 16) ' add 50h 16 times to ax
  181.                 edi = eax           ' stores eax in edi
  182.  
  183.         Next i   ' ends the loop
  184.  
  185.         Serial = edi     ' at the last loop, the serial is in edi
  186.  
  187.         Voilα, the keygen routine is finished. You can make a form with
  188. a couple of TextBox and a CommandButton and use this routine in the Command
  189. click event. The name is entered in one textbox and the serial retrieves
  190. in the second one.
  191.  
  192.         But you should note all the jo 0040DCD9 in the source code. It means
  193. that if your serial is upper to 32768= 2^15, you will have a overflow
  194. MessageBox in the crackme. So if you wanna perfect your keygen you could
  195. add a msgbox which appears is the serial is upper to 32768.
  196.         Note also that your serial could be lower to 0 if the name is mainly
  197. composed with numbers. Example: name= 123456 / serial= -2070. Just try and
  198. you'll see. So your keygen mustn't ignore the '-'.
  199.         Ok, i think it should be enough for making a great Key Generator.
  200. This is quite easy, isn't it ? And lots of softwares uses such a routine !
  201. And isn't it better to provide a Keygen rather than a serial ? or a crack ?
  202.  
  203. ____________________________________________________________________________
  204.  
  205. The end...
  206.  
  207.         What to say more ? hummm... I can't see. If you don't understand, or
  208. have critics, remarks... just send a mail at siflying@ifrance.com.
  209.  
  210.                 SiFLyiNG
  211.  
  212.         Greetz : i wanna thank HackerG from Execution for his crackme.
  213.                 Eternal Bliss, Acid Burn, Carpathia, Lucifer48, Glu, Ear
  214.                 and the others I've forgotten...
  215.        
  216.  
  217.  
  218.